<?php

namespace app\index\service;

use app\index\model\UM as UM;
use ShidianUtil\Exception\DataNotExistException;
use app\index\dao\TradeDao;
use app\common\model\Trade;
use think\Collection;

/**
 * Class RecentTradeService
 * @package app\index\service
 */
class RecentTradeService
{
    // dao
    private TradeDao $tradeDao;

    public function __construct(TradeDao $tradeDao)
    {
        $this->tradeDao = $tradeDao;
    }


    /**
     * 查询
     * @param UM $user
     * @return Trade
     */
    public function read(UM $user ): ?Trade
    {
        //这里如果要修改查询，建议把查询放到dao层去
        return $this->tradeDao->recentTrade($user->id);
    }


}
